user halo_op;
worker_processes {{ worker_processes }};
{% if num_cpus == 2 %}
worker_cpu_affinity 01 10;
{% if num_cpus == 4 %}
worker_cpu_affinity 0001 0010 0100 1000;
{% if num_cpus >= 8 %}
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
{% else %}
worker_cpu_affinity 0001 0010 0100 1000;
{% endif %}
worker_rlimit_nofile {{ max_open_file }};
pid /var/run/nginx.pid;

events {
    use epoll;
    worker_connections {{ worker_connections }};
}

http {

    include           mime.types;
    default_type      application/octet-stream;
    log_format        main    '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
                              '$status $body_bytes_sent "$http_referer" '
                              '"$http_user_agent" ';

    access_log           off;
    
    sendfile             on;
#    tcp_nopush          on;
    tcp_nodelay          on;
    keepalive_timeout    120;

    server_tokens        off;
    client_max_body_size 256M;

    gzip                 on;
    gzip_min_length 1k;
    gzip_buffers  4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types  text/plain application/x-javascript application/javascript application/font-woff2 text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;

    underscores_in_headers on;
    
    # include vhosts
    include vhost/*.conf;
}
